const { $wx, $http, img, target } = getApp()
const site = 'detail'
Page({
    data: { img },
    async onLoad({id}){
        this.id = id
        this.auth(id)
        this.friend = await $wx.share.friend(this, { param:{ site, target }, q:'id=' + id })
        this.collect = await $wx.share.collect(this, { param:{ site, target }, q:'id=' + id })
    },
    auth(id){
        $http.pull(this, 'room', { id })
    },
    onCall({currentTarget:{ dataset: { phone } }}){
        $wx.call(phone)
    },
    onShareAppMessage(e) { return $wx.share.msg(this, { param:{ site, target }, q:'id=' + this.id }) },
    onShareTimeline(){ return this.friend },
    onAddToFavorites(){ return this.collect },
})